package com.kly.ai.tools;

import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbacks;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author admin
 * @date 2025/5/29
 */
@Configuration
public class ToolRegister {

    @Resource
    private ObjectMapper objectMapper;

    @Value("${exa.apiKey}")
    private String apiKey;


    @Bean
    public ToolCallback[] allTools() {
        DateTimeTools dateTimeTools = new DateTimeTools();
        FileOperationTool fileOperationTool = new FileOperationTool();
        PDFGenerationTool pdfGenerationTool = new PDFGenerationTool();
        ResourceDownloadTool resourceDownloadTool = new ResourceDownloadTool();
        TerminalOperationTool terminalOperationTool = new TerminalOperationTool();
        WebScrapingTool webScrapingTool = new WebScrapingTool();
        ExaWebSearchTool exaWebSearchTool = new ExaWebSearchTool(apiKey);
        TerminateTool terminateTool = new TerminateTool();
        return ToolCallbacks.from(
                dateTimeTools,
                fileOperationTool,
                pdfGenerationTool,
                resourceDownloadTool,
                terminalOperationTool,
                webScrapingTool,
                exaWebSearchTool,
                terminateTool
        );
    }
}
